home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 18 / CU Amiga Magazine's Super CD-ROM 18 (1997)(EMAP Images)(GB)[!][issue 1998-01].iso / CUCD / Utilities / Commodities / ClipHistory / Rexx / Restore.cliph < prev    next >
Encoding:
Text File  |  1997-04-10  |  1.2 KB  |  52 lines

  1. /* Example ARexx script for ClipHistory 2.0+.
  2.  *
  3.  * Restores a previously dumped history from a drawer.
  4.  */
  5.  
  6. OPTIONS RESULTS
  7. ADDRESS CLIPHISTORY0
  8.  
  9. /* Change this to your drawer. Remember to include a terminating ':' or '/'.
  10.  * This should match your setting in Dump.cliph
  11.  */
  12. Drawer = 'Ram:'
  13.  
  14. Lf = '0a'x
  15.  
  16. /* Any entries in the history? */
  17. HistoryInfo
  18.  
  19. IF Word( RESULT, 1 ) ~= '0' THEN DO
  20.     RequestResponse PROMPT '"Should the current clips be removed first?"'
  21.  
  22.     IF RC = 0 THEN DO
  23.         DeleteAllItems FORCE
  24.     END
  25. END
  26.  
  27. /* There will never be more than 32767 clips in the history.
  28.  * Also, we will exit the loop when we don't find any more files.
  29.  */
  30. DO i = 1 TO 32767
  31.     /* This line requires rexxsupport.library to be available */
  32.     IF ~Exists( Drawer'ClipHistory.'i ) THEN DO
  33.         /* No more clips, it seems */
  34.         LEAVE i
  35.     END
  36.  
  37.     /* This is really a tad inefficient, as the clips are loaded via
  38.      * the clipboard, and not directly into the history. Oh well...
  39.      */
  40.     PutFile Drawer'ClipHistory.'i
  41.  
  42.     IF RC ~= 0 THEN DO
  43.         RequestResponse PROMPT '"Error restoring clip # 'i' (RC2='RC2')!'Lf'Continue loading clips?"'
  44.  
  45.         IF RC = 0 THEN DO
  46.             LEAVE i
  47.         END
  48.     END
  49. END
  50.  
  51. RequestNotify '"Restored 'i - 1' clips from 'Drawer'."'
  52.